package com.joysuch.wwyt.util;

/**
 * 图片富文本，拆分工具类
 * @Author ZhangDong
 * @Date 2020/8/27 17:06
 */
public class ImageRefUtil {

    /**
     * 拆出图片id
     * @param content
     * @return
     */
    public static Long getImageId(String content){
        String[] split = content.split("\\s");
        for (String s : split) {
            if(s.contains("src") && s.contains("/image/view")){
                int i = s.lastIndexOf("=");
                int j = s.lastIndexOf("\"");
                String substring = s.substring(i + 1, j);
                return Long.parseLong(substring);
            }
        }
        return null;
    }
}
